package algo;


public class Context
{
	private int nearNeighborsSize;
	private NearNeighborsEvaluator nearNeighborsEvaluator;
	private float toggleProbability;
	
	
	public Context(int nearNeighborsSize, NearNeighborsEvaluator nearNeighborsEvaluator, float toggleProbability)
	{
		this.nearNeighborsSize = nearNeighborsSize;
		this.nearNeighborsEvaluator = nearNeighborsEvaluator;
		this.toggleProbability = toggleProbability;
	}

	
	public int getNearNeighborsSize()
	{
		return nearNeighborsSize;
	}


	public void setNearNeighborsSize(int nearNeighborsSize)
	{
		this.nearNeighborsSize = nearNeighborsSize;
	}


	public NearNeighborsEvaluator getNearNeighborsEvaluator()
	{
		return nearNeighborsEvaluator;
	}


	public void setNearNeighborsEvaluator(NearNeighborsEvaluator nearNeighborsEvaluator)
	{
		this.nearNeighborsEvaluator = nearNeighborsEvaluator;
	}


	public double getToggleProbability()
	{
		return toggleProbability;
	}


	public void setToggleProbability(float toggleProbability)
	{
		this.toggleProbability = toggleProbability;
	}


	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((nearNeighborsEvaluator == null) ? 0 : nearNeighborsEvaluator.hashCode());
		result = prime * result + nearNeighborsSize;
		long temp;
		temp = Double.doubleToLongBits(toggleProbability);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}


	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Context other = (Context) obj;
		if (nearNeighborsEvaluator == null)
		{
			if (other.nearNeighborsEvaluator != null)
				return false;
		} else if (!nearNeighborsEvaluator.equals(other.nearNeighborsEvaluator))
			return false;
		if (nearNeighborsSize != other.nearNeighborsSize)
			return false;
		if (Double.doubleToLongBits(toggleProbability) != Double.doubleToLongBits(other.toggleProbability))
			return false;
		return true;
	}


	@Override
	public String toString()
	{
		return "Context [nearNeighborsSize=" + nearNeighborsSize + ", nearNeighborsEvaluator=" + nearNeighborsEvaluator
				+ ", toggleProbability=" + toggleProbability + "]";
	}
	
	
}
